COMAL-80-C64-SPRITE-ON-THE-TEXTSCREEN -------------------------------------------------------------------------------------------------- TOOL: COMAL-80-C64-v2.01 Language: Structured BASIC Extra: - Author: Misel Zivanovic Note: (C) 8th MARCH 2026 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- Default PAGE is SETPAGE(1) which represents {or limit} the access to BASIC part of the memory. Now, there are more PAGES, including the one giving you the access to full 64K MEMORY. Well, latest now you probably should know what you are doing because the MAP isn't the same as when using C64 as C64 and BASIC 2.0 Example: {access via SETPAGE(0)} Sprite definitions are starting @ $d000, dec 53248 and are going up to plus 2048 bytes = 32 sprites These sprites can be used only when COMAL graphicscreen is active! What we want is to show sprites on the text screen and that is actually working at the beginning! We are using POINTER 13, which is then 13x64 bytes = 832 {memory address} Check screenshot 1 showing how it is working. EXAMPLE 1: {SPRITE VISIBLE} 0010 FOR a:=0 TO 63 DO POKE 832+a,255 0020 POKE 2040,13 // pointer 13x64=832 0030 POKE 53269,1 // sprite on 0040 POKE 53248,180 // x 0050 POKE 53249,180 // y So far soo good! However, at some point you'll just have to use SETPAGE to access the specific memory block you need or all 64K at once in order to change settings or just to load whatever you need, e.g. sprite definitions into memory for later use... That would then look like this: {we switch to SETPAGE 0 in order to add data to our sprite zero which then can be seen on the high resolution screen. Then we return to BASIC PAGE, SETPAGE 1 which is a default PAGE and where our sprite was visible before! However now it is gone and you *won't see it any more!} EXAMPLE 2: {SPRITE GONE} 0010 USE system 0020 setpage(0) 0030 FOR a:=0 TO 63 DO POKE 53248+a,129 0035 FOR a:=0 TO 63 DO POKE 832+a,255 0040 POKE 2040,13 // pointer 13x64=832 0050 POKE 53269,1 // sprite on 0060 POKE 53248,180 // x 0070 POKE 53249,180 // y 0085 setpage (1) // default page, BASIC * = that is: you will, however only after you type NEW and run the 1st example again! but, that cannot be a solution, right! Well, well... That is a nasty habit if you ask me! As said, i needed a century to just realize where was the problem in first place! One of the obstacles was that COMAL 80 isn't really widely used and in the past people used COMAL 0.14 also at the times when COMAL 2.x was available already for many years. In other words there was no solution existing for this problem. Obviously nobody wanted to be bothered with that. And so in year 2025 i actually accidentally stumbled over the solution and at 1st I even didn't realized that i found it, haha... Long story short, to make the sprite accessible again when using text screens, you have to active the page $81 SETPAGE {$81} for the section where you need to make changes to the sprites located on the text screen! So this code will work again! EXAMPLE 3: {SCREENSHOT 3} list 0010 USE system 0020 setpage(0) 0030 FOR a:=0 TO 63 DO POKE 53248+a,129 0040 setpage($81) 0050 FOR a:=0 TO 63 DO POKE 832+a,255 0060 POKE 2040,13 // pointer 13x64=832 0070 POKE 53269,1 // sprite on 0080 POKE 53248,180 // x 0090 POKE 53249,180 // y 0100 setpage(1) // default page, BASIC It looks so easy, but it wasn't found the past 40 years as it looks! Alright, now you know how it is done! Interesting thing is, the official COMAL-80 Book for C64 is pointing to page 212 in regard to SETPAGE command. But when you get to check that, you'll find how there is actually nothing to see and SETPAGE is appearing just once in whole book in INDEX section as a pointer to where SETPAGE should be explained} I guess they just had no time for this part and let it be. Or if was forgotten!? The SPRITE mystery is resolved. Now also C64 user can have sprites on the text screen and also the full access to everything else COMAL-80 is offering. WONDERFUL! --------------------------------------------------------------------------------------------------- GOOD TO KNOW! You can use some of the commands COMAL is offering. Example: SPRITEPOS (0,180,199) Now you would think how this will place the sprite at the same position like typing: 0010 POKE 53248,180 // x position 0020 POKE 53249,199 // y-position You will be surprised! It will be quite the opposite! SPRITEPOS (will place the sprite on the top of the screen} and POKE to the bottom! That is so because COMAL is having 0,0 NOT in the TOP LEFT CORNER, it is in BOTTOM LEFT CORNER and it's going up from there to 200 {0-199} The biggest advantage when using COMAL-SPRITE-COMMANDS? You can cover the full screen e.g. SPRITEPOS (0,300,100). Compared to that, POKE can just reach max of 255 and then you would need to use the 9th bit for sprite x position {POKE 53264,x} ..then SPRITECOLOR, SPRITESIZE etc.